#!/usr/bin/env sh
# Copyright 2017-2021 (c) all rights reserved by SDRausty, see LICENSE.
# https://sdrausty.github.io/au  Contributors: frumpylava/Glow, Hax4us
# $ dpkg --purge name.pkg; dpkg --install name.pkg  ## downgrades packages. 
# An external microSD card path is preferred in order to save native space on device, change path /storage/emulated/0/Android/media/com.termux/txdebs to a microSDcard destination to save native space on device.
################################################################################
mkdir -p /storage/emulated/0/Android/media/com.termux/txdebs/
# update, upgrade and install packages or print message
( apt update && apt -o APT::Keep-Downloaded-Packages="true" upgrade -y && apt -o APT::Keep-Downloaded-Packages="true" install $@ -y  && mv "$PREFIX"/var/cache/apt/archives/*.deb /storage/emulated/0/Android/media/com.termux/txdebs/ >&2 ) || printf "\\n%s\\n\\n" "Something unexpected occured;  Please study the last lines of output, and run ${0##*/} again to install and auto update packages!" 
# au EOF
